<template>
    <div class="user-info">
        <p>账户ID: {{ account.accountId }}</p>
        <p>用户ID: {{ account.userId }}</p>
        <p>用户昵称: {{ account.user.name }}</p>
        <!--        <p>性别: {{ account.user.sex }}</p>-->
        <p>渠道: <tag-app-source :source="account.source"></tag-app-source></p>
        <p>登录方式: {{ account.loginWay }}</p>
<!--        <p>设备: {{ account.device }}</p>-->
<!--        <p>机型: {{ account.os }}</p>-->
        <p>网关: {{ account.gateIp }}</p>
        <p>设备号: {{ account.uuid }}</p>
        <p>IP: {{ account.ip }}</p>
        <p>成长值: {{ account.user.vipVal / 10 }}</p>
        <p>总在线: {{ account.user.onlineTime }}</p>
        <p>总充值: {{ account.user.totalpay / 100 }} 元</p>
        <p>总权益: {{ account.user.withdraw / 100 }} 元</p>
<!--        <p>机器人: <boolean-icon :data="account.user.dummy"></boolean-icon></p>-->
        <p>紫钻: {{ account.user.diamond }} 个</p>
    </div>
</template>

<script>
    export default {
        name: "AccountInfo",
        props: {
            data: {
                // type: [Number, Object, Null],
                required: true
            },
        },
        data() {
            return {
                account: {
                    user: {

                    }
                }
            };
        },
        watch: {
            data() {
                if (typeof this.data === 'number') {
                    this.getData();
                } else {
                    if (this.data) this.account = this.data;
                }
            }
        },
        methods: {
            getData() {
                this.$store.dispatch('user/Show').then(res => {
                    this.account = res.data;
                });
            }
        },
        created() {
            if (this.data) this.account = this.data;
        }
    }
</script>

<style lang="scss" scoped>
.user-info {
    p {
        /*height: 30px;*/
        line-height: 30px;
        border-bottom: 1px solid #eee;
        font-size: 12px;
    }
}
</style>
